/*
 * Copyright (c) 2022 上海市政工程设计研究总院(集团)有限公司 All Rights Reserved.
 */
package com.smedi.ismedi.progress.core.application.convert;

import com.smedi.ismedi.progress.api.dto.request.*;
import com.smedi.ismedi.progress.core.application.command.EngineeringConstructionCompletionSave;
import com.smedi.ismedi.progress.core.application.command.EngineeringImportantNodePlanSave;
import com.smedi.ismedi.progress.core.application.command.EngineeringLicenseFileSave;
import com.smedi.ismedi.progress.core.application.command.VersionManageOneQuery;
import com.smedi.ismedi.progress.core.domain.aggregatemodel.ConstructionLogContent;
import com.smedi.ismedi.progress.core.domain.aggregatemodel.File;
import com.smedi.ismedi.progress.core.domain.aggregatemodel.OneAndKeyAndMilestoneTaskList;
import com.smedi.ismedi.progress.core.domain.dto.VersionManageQuery;
import com.smedi.ismedi.progress.core.port.adapter.persistence.model.EngineeringImportantNodePlanEntity;
import com.smedi.ismedi.progress.core.port.adapter.persistence.model.EngineeringLicenseAttachmentImageEntity;
import com.smedi.ismedi.progress.core.port.adapter.persistence.model.ProgressDetailEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.ReportingPolicy;

import java.util.List;

/**
 * application Converter
 *
 * @author 15428
 * &#064;date  2022-06-07 15:22:03
 * @since 0.0.1
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface AppConverter {
    @Mapping(target = "signKey")
    @Named("keyToAttachment")
    List<File> keyToAttachment(List<String> signKeys);

    @Mapping(target = "signKey")
    File keyToAttachment(String signKey);

    VersionManageQuery versionManageOneQueryToVersionManageQuery(VersionManageOneQuery versionManageOneQuery);

    @Mapping(source = "attachmentKeys", target = "attachments", qualifiedByName = "keyToAttachment")
    OneAndKeyAndMilestoneTaskList OneAndKeyAndMilestoneTaskListEidtSaveRequestToOneAndKeyAndMilestoneTaskList(OneAndKeyAndMilestoneTaskListEidtSaveRequest oneTasklists);

    @Mapping(source = "name", target = "milepostName")
    EngineeringImportantNodePlanEntity progressDetailEntityToEngineeringImportantNodePlanEntity(ProgressDetailEntity progressDetails);

    @Mapping(source = "attachmentKeys", target = "attachments", qualifiedByName = "keyToAttachment")
    @Mapping(source = "licenseName", target = " projectLicenseHandlingNameEnum")
    EngineeringLicenseFileSave licenseToEngineeringLicenseFileSave(EngineeringLicenseFileRepuest license);

    @Mapping(source = "attachmentKeys", target = "attachments", qualifiedByName = "keyToAttachment")
    EngineeringConstructionCompletionSave engineeringConstructionCompletionToEngineeringConstructionCompletionSave(EngineeringConstructionCompletionRequest engineeringConstructionCompletion);
}
